//
//  main.m
//  03-NSStringNSArrayNSMutableArray
//
//  Created by 402030900@qq.com on 16/7/6.
//  Copyright © 2016年 402030900@qq.com. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Book.h"
#import "BookManager.h"
int main(int argc, const char * argv[]) {
    
//    截取字符串 "20|https://www.baidu.com" 中 "|" 前面和后⾯的字符串, 并输出
    NSString * string = @"20|https://www.baidu.com";
    NSArray* strComponets = [string componentsSeparatedByString:@"|"];
    NSLog(@"%@",strComponets);
    
//    向可变数组里存储 int、float、double、BOOL类型等数据(不能使用字面量)
    int a = 5;
    float b = 6.0;
    double c = 3.14;
    BOOL d = 1;
    NSMutableArray * mutableArray = [NSMutableArray array];
    [mutableArray addObject:[NSNumber numberWithInt:a]];
    [mutableArray addObject:[NSNumber numberWithFloat:b]];
    [mutableArray addObject:[NSNumber numberWithDouble:c]];
    [mutableArray addObject:[NSNumber numberWithBool:d]];
    NSLog(@"%@",mutableArray);
    
//    实现图书管理系统(BookManager类)：
//    使用数组管理所有书籍(Book类)。
//    BookManager类属性数组可以添加、删除。
//    可以从数组根据书名查找书籍，并修改书籍的价格。
//    展示所有书籍清单（书名）
    BookManager *manager = [[BookManager alloc] init];
    Book *book1 = [Book bookWithName:@"语文" price:@"11"];
    Book *book2 = [Book bookWithName:@"数学" price:@"12"];
    Book *book3 = [Book bookWithName:@"英语" price:@"13"];
    [manager addBook:book1];
    [manager addBook:book2];
    [manager addBook:book3];
    [manager removeBook:book1];
    [manager modifyPriceName:@"语文" Price:@"44"];
    [manager showBook];
    
    return 0;
}
